﻿/*
生成mongopage 页面请求
expireData:过期时间类型：d:天数  h:小时 m:分钟
*/
var sMongoSiteUrl = "http://mongosite.64365.com/default.aspx";
function getmongopage(expireType, expireNumber, url) {
    url = url ? url : window.location.href;
    if (new RegExp("mongo\\.64365\\.com").test(url)) { return; }
    //doAjax(sMongoSiteUrl, { type: "mongopage", expireType: expireType, expireNumber: expireNumber, url: url }, function () { }, "jsonp", function () { });
    var tempUrl = sMongoSiteUrl + '?n=' + Math.random(0, 1) + "&type=mongopage&url=" + url + "&expireType=" + expireType + "&expireNumber=" + expireNumber;
    $('body:first').append('<script type="text/javascript" src="' + tempUrl + '"></script>');
}
function getcookie(name) { var strcookie = document.cookie; var arrcookie = strcookie.split("; "); for (var i = 0; i < arrcookie.length; i++) { var arr = arrcookie[i].split("="); if (arr[0] == name) return arr[1]; } return ""; }

document.domain = "64365.com";
/*
根据IPNAME获取当前城市的名称
*/
var currCityName;
var currCityPingyin;

$(function () {
     if ($("a[name=a_citypinyin]").length > 0) {
        $("a[name=a_citypinyin]").attr("href", "/chaoyangqu/");
        $("#a_cityname").html("朝阳区");
        $("#a_cityname2").html("朝阳区律师");
        $.ajax({
            url: "/ajax/ipposition.aspx?_=" + Math.random(0, 1),
            dataType: "xml",
            contentType: "application/x-www-form-urlencoded; charset=utf-8",
            cache: false,
            type: "POST",
            data: { type: "postition" },
            success: function (response) {
                var type = $(response).find("type").text();
                var msg = $(response).find("msg").text();
                if (type == 1) {
                    msg = msg.split("|");
                    currCityName = msg[0];
                    currCityPingyin = msg[1];
                    if (currCityPingyin) {
                        $("a[name=a_citypinyin]").attr("href", "/" + currCityPingyin + "/");
                        $("[name=\"a_cityname\"]").html(currCityName);
                        $("#a_cityname2").html(currCityName + "律师" + "<i class=\"ico-ft i-jt3\"></i>");
                        //预约见面首页更多律师链接
                        if ($('#morelawyer')) {
                            $('#morelawyer').attr('href', '/' + currCityPingyin + '/');
                        }
                        //首页2我身边的律师链接
                        if ($('#nearlawyer')) {
                            $('#nearlawyer').attr('href', '/' + currCityPingyin + '/');
                        }
                    }
                }
            },
            error: function () { }
        });
    }
});


